# ------------------------------------------------------------------------------
# Builds cardiology feature model.
# Author: Cassidy Shubatt <cshubatt@gmail.com>
# To run: bsub -q big -R "rusage[mem=100000]" make
# ------------------------------------------------------------------------------
.ONESHELL:
include config.mk

# override with `make SPLIT={split}`
# SPLITS: {random,overnight}
SPLIT=random
ifeq ($(SPLIT),random)
  overnight_lab =
else
  overnight_lab = _overnight
endif

# Recipes ----------------------------------------------------------------------
.PHONY : all
all : cardiology_model

## cardiology_model	: Models risk from cardiologist's features
.PHONY : cardiology_model
cardiology_model: $(CARDIOLOGY_MODEL)
$(CARDIOLOGY_MODEL) : 01_car_features_model.sh scripts/01_car_features_model.R
	bash $< $(SPLIT)

# Config targets ---------------------------------------------------------------
## style			: Styles R scripts according to tidyverse guidelines
.PHONY: style
style:
	source ~/anaconda3/etc/profile.d/conda.sh
	conda activate stressr
	R --vanilla --silent -e "styler::style_dir(path = 'scripts', filetype = c('R', 'Rmd', 'Rprofile'))"

.PHONY : help
help : Makefile
	@sed -n 's/^##//p' $<
